package com.shy.servlet;

import com.shy.service.StudentService;
import com.shy.service.impl.StudentServiceImpl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 处理根据学号删除单个学生请求的Servlet
 * 

 */
@WebServlet("/doss")
public class DeleteOneStudentServlet extends HttpServlet {
    
    StudentService studentService = new StudentServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //1. 获取请求参数
        //获取要删除的学生的学号
        String rollno=req.getParameter("sid");
        
        //2. 调用业务逻辑，完成请求处理
        //根据学号从数据库删除学生
        studentService.unregister(rollno);
        
        //3. 生成响应内容，因为这里删除学生使用ajax发送的请求，不打算给任何响应数据，所以就没打印响应内容
    }
}
